/**
 * 
 */
package com.pmsco.pms.business;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.pmsco.pms.business.dto.AdminMainInfoRequestDTO;
import com.pmsco.pms.business.dto.AdminMainInfoReturnDTO;
import com.pmsco.pms.core.constant.PmsConstant;
import com.pmsco.pms.core.domain.PmsSysInformation;
import com.pmsco.pms.services.impl.PmsSysInformationServiceImpl;
import com.pmsco.pms.services.interfaces.PmsSysInformationService;


/**
 * @author Long Tran
 *
 */
public class AdminBusiness {
	private static final Logger logger = LoggerFactory.getLogger(AdminBusiness.class);
	private PmsSysInformationService pmsSysInformationService = new PmsSysInformationServiceImpl();
	
	public AdminMainInfoReturnDTO loadAdminMainInfo(AdminMainInfoRequestDTO adminMainInfoRequestDTO) {
		logger.info("Start loadAdminMainInfo");
		AdminMainInfoReturnDTO adminMainInfoReturnDTO = new AdminMainInfoReturnDTO();
		
		PmsSysInformation pmsSysInformation = pmsSysInformationService.loadPmsSysInformation();
		adminMainInfoReturnDTO.setPmsSysInformation(pmsSysInformation);
		adminMainInfoReturnDTO.setReturnView(PmsConstant.adminMain_View);
		
		logger.info("End loadAdminMainInfo");
		return adminMainInfoReturnDTO;
	}
	
	public AdminMainInfoReturnDTO savePmsSysInformation(AdminMainInfoRequestDTO adminMainInfoRequestDTO) {
		logger.info("Start savePmsSysInformation");
		AdminMainInfoReturnDTO adminMainInfoReturnDTO = new AdminMainInfoReturnDTO();
		
		if(adminMainInfoRequestDTO.getPmsSysInformation() != null)
			pmsSysInformationService.saveOrUpdatePmsSysInformation(adminMainInfoRequestDTO.getPmsSysInformation());
		adminMainInfoReturnDTO.setReturnUrl(PmsConstant.adminMain_JspUrl);
		
		logger.info("End savePmsSysInformation");
		return adminMainInfoReturnDTO;
	}
}
